/************************************************************************/
/* Class defines a single emotional memory                                                                     */
/************************************************************************/

#pragma once

#include "Role.h"

#include "emotion.h"
#include "typdefs.h"
#include "GameTime.h"

#include <string>
#include "event.h"

namespace BAA
{
	// forward declaration
	class Agent;
	class Role;

	class Emotion;
	class Event;
	typedef std::map<const std::string, Emotion*>			StringEmotionMap;
	

	class EmotionalMemory
	{
	public:

		EmotionalMemory()
		{

		}

		~EmotionalMemory()
		{
			// delete emotions?

		}

		void Create();

		void Initialize(Role * parentRole);

		void Clear();

		inline void AddEmotion(std::string name, Emotion * emotion)
		{
			if(emotion == NULL)
				return;         // throw information to log ? 
			else
				(*mEmotionMap)[name] = emotion;
		}
		
		inline void RemoveEmotion(Emotion * emotion)
		{
			if(emotion == NULL)
				return;
			else
			{
				//TODO:
					
			}

		}


		virtual void Update(GameTime time)
		{
			//for(emotions::iterator i = emotions.begin(); i < emotions.end(); ++i)
			//	emotions[i].Update(elapsedTime);

		}

		float Age() const { return age; }
		void Age(float val) { age = val; }

		Role * RoleParent() const { return mRoleParent; }
		void RoleParent(Role * val) { mRoleParent = val; }

		BAA::StringEmotionMap* EmotionMap() { return mEmotionMap; }
		void EmotionMap(BAA::StringEmotionMap* val) { mEmotionMap = val; }

		Event* GetEvent() { return mEvent; }
		void SetEvent(Event* val) { mEvent = val; }

	protected:

		Role *				mRoleParent;
		float				age;
		StringEmotionMap *	mEmotionMap;
		Event* 				mEvent;

	};// end class

}